import type {
  orderDetailsType,
  cancelPrePayOrderType,
  goodCodeType,
  makeNowType,
  orderListType,
  orderRefundType,
} from '@/types/goods'
import { http } from '@/utils/http'
/**
 * * getUserOrderApi 获取订单列表 GET  /client/order/applet/limit/status
 * @param userId
 * @param status
 * @param pageNum
 * @param pageSize
 * @param latitude
 * @param longitude
 */
export const getOrderListApi = (data: orderListType) => {
  return http<any>({
    method: 'GET',
    url: '/client/order/applet/limit/status',
    data,
  })
}
/**
 * * getOrderDetailsApi 获取订单详情 /applet/detail
 * @param orderId
 * @param latitude
 * @param latitude
 */
export const getOrderDetailsApi = (data: orderDetailsType) => {
  return http<any>({
    method: 'GET',
    url: '/client/order/detail',
    data,
  })
}

/**
 *
 * * cancelPrePayOrderApi  取消预支付订单
 * @returns
 */
export const getCancelPrePayOrderApi = (data: orderRefundType) => {
  return http<any>({
    method: 'GET',
    url: '/client/order/cancel',
    data,
  })
}

/**
 *
 * * orderRefundApi 订单退款
 * @returns
 */
export const getOrderRefundApi = (data: orderRefundType) => {
  return http<any>({
    method: 'GET',
    url: '/client/order/refund',
    data,
  })
}
/**
 *
 * *  取餐码接口
 * @param orderId: string
 * @param orderDetailId?: string[]
 * @returns
 */
export const postQRCodeApi = (data: goodCodeType) => {
  return http<any>({
    method: 'POST',
    url: '/client/order/detail/QRCode',
    data,
  })
}
/**
 *
 * * getUserOrderDetailsApi 获取用户订单详情接口
 * @param  latitude: string
 * @param   longitude: string
 * @param   orderId: string
 * @returns
 */
export const getUserOrderDetailsApi = (data: {
  latitude: string
  longitude: string
  orderId: string
}) => {
  return http<any>({
    method: 'GET',
    url: '/client/order/detail',
    data,
  })
}
/**
 *
 * * makeNowApi 立即制作套餐
 * @param orderId: string
 * @param orderDetailId?: string[]
 * @returns
 */

export const postMakeNowApi = (data: { orderId: string }) => {
  return http<any>({
    method: 'POST',
    url: '/client/order/detail/action/package/make',
    data,
  })
}

/**
 *
 * *  客服代取
 * @param orderId: string
 * @param orderDetailId?: string[]
 * @returns
 */

export const postReplaceApi = (data: { orderId: string }) => {
  return http<any>({
    method: 'POST',
    url: '/client/order/detail/operation/pickup',
    data,
  })
}
/** 前三次弹窗提示 */
export const getPopupTipsApi = () => {
  return http<any>({
    method: 'GET',
    url: '/client/order/guidance/popup',
  })
}

/** 首页订单状态提醒 */
export const getOrderStatusTipsApi = () => {
  return http<any>({
    method: 'GET',
    url: '/client/order/status/remind',
  })
}
